package regression;

import utils.message.Message;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jettison.json.JSONException;
import utils.message.MessageContents;
import utils.message.client.PostUrl;
import utils.message.client.ClientPost;


public class Regression {
	private User creator;
	private User currentUser;
	private List<User> dataSourceUsers = new ArrayList<User>();
	private RegressionType regressionType;
	private RegressionHandler regressionHandler;
	private List<Message> unackedMessage = new ArrayList<Message>();

	public User getCreator() {
		return creator;
	}

	public void setCreator(User creator) {
		this.creator = creator;
	}

	public User getCurrentUser() {
		return currentUser;
	}

	public void setCurrentUser(User currentUser) {
		this.currentUser = currentUser;
	}

	public List<User> getDataSourceUsers() {
		return dataSourceUsers;
	}

	public void setDataSourceUsers(List<User> dataSourceUsers) {
		this.dataSourceUsers = dataSourceUsers;
	}

	public RegressionType getRegressionType() {
		return regressionType;
	}

	public void setRegressionType(RegressionType regressionType) {
		this.regressionType = regressionType;
	}

	public RegressionHandler getRegressionHandler() {
		return regressionHandler;
	}

	public void setRegressionHandler(RegressionHandler regressionHandler) {
		this.regressionHandler = regressionHandler;
	}

	public List<Message> getUnackedMessage() {
		return unackedMessage;
	}

	public void setUnackedMessage(List<Message> unackedMessage) {
		this.unackedMessage = unackedMessage;
	}

	public void addUser(User user) {
		dataSourceUsers.add(user);
	}
        public void pingUser(User user) throws JSONException {
            String url = PostUrl.generateUrl(user, PostUrl.PIN);
            Message message = new Message(MessageContents.PING);
            ClientPost.send(message.toString(), url);
	}


}
